package com.jettech.oa.dao;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.jettech.oa.domain.WorkFlow;
import com.jettech.oa.domain.WorkFlowForm;

@Repository("workFlowDAO")
public class WorkFlowDAO extends GenericDAOHibernate<WorkFlow,Long>{
	@Autowired
	public WorkFlowDAO(SessionFactory sessionFactory){
		this.setSessionFactory(sessionFactory);
	}

	public void deleteWorkFlowForm(Long id) {
		String hql = "delete from WorkFlowForm where workFlow.id = ?";
		this.getHibernateTemplate().bulkUpdate(hql,id);
	}

	public void saveWorkFlowForm(WorkFlowForm form) {
		this.getHibernateTemplate().save(form);
	}

	public void deleteWorkFlowFormProperty(Long workFlowFormId) {
		String hql = "delete from FormProperty where workFlowForm.id = ?";
		this.getHibernateTemplate().bulkUpdate(hql,workFlowFormId);
	}
	
}
